package com.afdor.rws.event.driven.support.holder;

import com.afdor.rws.event.driven.api.EventHolder;
import com.afdor.rws.event.driven.entities.Event;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;

/**
 * 事件执行返回结果
 *
 * @author 悭梵
 * @date Created in 2018-12-05 13:54
 */
@Setter
@Getter
@ToString
@EqualsAndHashCode
@RequiredArgsConstructor
public class EventResult<T> implements Serializable, Cloneable, EventHolder {

    /**
     * 返回状态码
     *
     * @see Event.Status
     */
    private int code;

    /**
     * 返回消息
     */
    private String message;

    /**
     * 返回消息
     */
    private T data;

    /**
     * 所属事物标识
     */
    private String transactionId;

    /**
     * 对应事件对象
     */
    private final Event event;
}
